package mythesis.gui.main.components.api;
import javafx.scene.*;
import javafx.scene.shape.*;
import javafx.scene.paint.*;
import javafx.scene.text.*;
import javafx.scene.input.*;


public class TilePopupButton extends CustomNode
{
    public var color = 1;
    public var type = 0;	// 0 - char, 1 - var
    public var text = "-";
    public var width = 100;
    //var defaultFill = "#4583C0"; //#006600
    //var clickFill = "#366BA0"; //#009700
    //var hoverFill = "#76A4D1"; //#00EA00
    var defaultFill:String[] = ["#4583C0", "#00A800"];
    var clickFill:String[]   = ["#366BA0", "#009700"];
    var hoverFill:String[]   = ["#76A4D1", "#00EA00"]; 
    

	var curFill = defaultFill[color-1];
	
    override public function create() : Node
    {
        return Group
        {
            translateY: 2
        	content:
        	[
        		Rectangle
        		{
        		    width     : width;
        		    height    : 15;
        		    arcHeight : 5;
        		    arcWidth  : 5;
        		    fill      : bind Color.web(curFill);
        		    onMousePressed: function( e: MouseEvent ): Void
        		    				{
        		        				curFill = clickFill[color-1];
        		    				}
        		    onMouseReleased: function( e: MouseEvent): Void
        		    				 {
        		        				curFill = defaultFill[color-1];
        		    				 }
        		    onMouseEntered: function( e: MouseEvent): Void
        		    				 {
        		        				curFill = hoverFill[color-1];
        		    				 }
        		    onMouseExited: function( e: MouseEvent): Void
        		    				 {
        		        				curFill = defaultFill[color-1];
        		    				 }
        		}
        		Text
        		{
        		    content : bind text		//14 max
        		    x       : 5
        		    y       : 10
        		    font    : Font.font("Courier New", FontWeight.BOLD, 10); 
        		}
        	]   
        }
    }
}